package su.samcom.calc.model.entity;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: Владислав
 * Date: 19.11.13
 * Time: 23:25
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "calc_samcom_su.route")
public class Route implements Serializable {
    private static final long serialVersionUID = 6778643894748390373L;

    private Long id;
    private Location locationA;
    private Location locationB;
    private PriceStrategy priceStrategy;
    private PriceStrategy inheritedPriceStrategy;
    private Double bonusGeneralCargo;
    private Double bonusGeneralCargoPercent;
    private Double bonusSeparateCargo;
    private Double bonusSeparateCargoPercent;

    @Id
    @SequenceGenerator(name = "route_gen", sequenceName = "calc_samcom_su.route_seq", allocationSize = 1)
    @GeneratedValue(generator = "route_gen", strategy = GenerationType.SEQUENCE)
    @Column(name = "id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "location_a_id")
    public Location getLocationA() {
        return locationA;
    }

    public void setLocationA(Location locationA) {
        this.locationA = locationA;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "location_b_id")
    public Location getLocationB() {
        return locationB;
    }

    public void setLocationB(Location locationB) {
        this.locationB = locationB;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "price_strategy_id")
    public PriceStrategy getPriceStrategy() {
        return priceStrategy;
    }

    public void setPriceStrategy(PriceStrategy priceStrategy) {
        this.priceStrategy = priceStrategy;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "inherited_price_strategy_id")
    public PriceStrategy getInheritedPriceStrategy() {
        return inheritedPriceStrategy;
    }

    public void setInheritedPriceStrategy(PriceStrategy inheritedPriceStrategy) {
        this.inheritedPriceStrategy = inheritedPriceStrategy;
    }

    @Column(name = "bonus_general_cargo")
    public Double getBonusGeneralCargo() {
        return bonusGeneralCargo;
    }

    public void setBonusGeneralCargo(Double bonusGeneralCargo) {
        this.bonusGeneralCargo = bonusGeneralCargo;
    }

    @Column(name = "bonus_general_cargo_percent")
    public Double getBonusGeneralCargoPercent() {
        return bonusGeneralCargoPercent;
    }

    public void setBonusGeneralCargoPercent(Double bonusGeneralCargoPercent) {
        this.bonusGeneralCargoPercent = bonusGeneralCargoPercent;
    }

    @Column(name = "bonus_separate_cargo")
    public Double getBonusSeparateCargo() {
        return bonusSeparateCargo;
    }

    public void setBonusSeparateCargo(Double bonusSeparateCargo) {
        this.bonusSeparateCargo = bonusSeparateCargo;
    }

    @Column(name = "bonus_separate_cargo_percent")
    public Double getBonusSeparateCargoPercent() {
        return bonusSeparateCargoPercent;
    }

    public void setBonusSeparateCargoPercent(Double bonusSeparateCargoPercent) {
        this.bonusSeparateCargoPercent = bonusSeparateCargoPercent;
    }
}
